package com.itwang.test2;

public class GameTest {
    public static void main(String[] args) {
        Role r1 = new Role("张三",100,'男');
        Role r2 = new Role("小红",80,'女');

        // 展示角色信息
        r1.showRoleInfo();
        r2.showRoleInfo();

        while(true) {
            r1.attack(r2);
            // 判断r2的血量
            if(r2.getBlood() == 0) {
                System.out.println(r1.getName() + "K.O了" + r2.getName() );
                break;
            }

            // r2开始攻击r1
            r2.attack(r1);
            if (r2.getBlood() == 0) {
                System.out.println(r2.getName() + "K.O了" + r2.getName());
                break;
            }
        }

    }
}
